import cv2

img = cv2.imread("../images/02.png")
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
_, img_binary = cv2.threshold(
    img_gray,
    127,
    255,
    cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU
)

cv2.imshow("img_binary", img_binary)
cv2.waitKey(0)
kernel_1 = cv2.getStructuringElement(0, (15, 15))
img_erode = cv2.erode(img_binary,kernel=kernel_1)
cv2.imshow("img_erode", img_erode)
cv2.waitKey(0)


kernel_2 = cv2.getStructuringElement(0, (15, 15))
img_erode = cv2.dilate(img_binary,kernel=kernel_2)
cv2.imshow("img_dilate", img_erode)
cv2.waitKey(0)